﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace devtm.Aop.Convert
{
    
    [System.Diagnostics.DebuggerStepThrough]
    class Container
    {


        public object Key { get; set; }

        public Container(object key)
        {
            this.Key = key;
        }

        private Hashtable _dicTraitement = new Hashtable();


        internal Convert.ContainerTypeDefiniton Get(Mono.Cecil.TypeDefinition t)
        {

            Convert.ContainerTypeDefiniton retour = null;

            if (_dicTraitement.ContainsKey(t.FullName))
                retour = _dicTraitement[t.FullName] as Convert.ContainerTypeDefiniton;
            else
            {
                retour = new Convert.ContainerTypeDefiniton(t);
                _dicTraitement.Add(t.FullName, retour);
            }

            return retour;



        }

        internal IEnumerable<Convert.ContainerTypeDefiniton> Get()
        {

            foreach (Convert.ContainerTypeDefiniton item in _dicTraitement.Values)
                yield return item;
            
        }

    }

}
